package com.Samuel.Calculator;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class CalculatorActivity extends Activity implements OnClickListener{
	EditText textview;
	int [] ButtonID = {R.id.b0,R.id.b1, R.id.b2,R.id.b3, R.id.b4, R.id.b5, R.id.b6, R.id.b7,
			R.id.b8, R.id.b9};
	int[] opButtons = { R.id.bAdd, R.id.bCLR, R.id.bEq, R.id.bDiv, R.id.bMult, R.id.bSub	
	};
	double num1=0;
	double num2;
	Button [] Buttons;
	Button [] opButton;

	String [] Display = {"0","1","2","3","4","5","6","7","8","9","+","c","=","/","-"};/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);


		textview = (EditText) findViewById(R.id.editText1);
		Buttons = new Button[15];
		for(int i = 0; i<1; i++){
			Buttons[i] = (Button) findViewById(ButtonID[i]);
			Buttons[i].setOnClickListener(this);
		}
		opButton = new Button[6];
		for(int i = 0; i<6; i++){
			opButton[i] = (Button) findViewById(opButtons[i]);
			opButton[i].setOnClickListener(this);
		}



	}

	public void onClick(View v) {


		if(v.equals(opButton[0])){
			num2=Double.parseDouble(textview.getText().toString());
			num1 += num2;

		}
		if(v.equals(opButton[5])){
			num1 -= num2;
		}
		if(v.equals(opButton[4])){

		}
		if(v.equals(opButton[3])){

		}
		if(v.equals(opButton[2])){

		}
		if(v.equals(opButton[1])){

		}
		else{
			textview.append(((Button)v).getText().toString());
		}



	}
}